/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package giormi;

/**
 *
 * @author Ling
 */
import java.util.Calendar;
import java.text.SimpleDateFormat;

public class date {
  public static final String DATE_FORMAT_NOW = "MM/dd/yy";

  public static String now() {
    Calendar cal = Calendar.getInstance();
    SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
    return sdf.format(cal.getTime());
  }

  public static void  main(String arg[]) {
    System.out.println("Now : " + date.now());
  }

  public static String convertDate(String inputDate) {
    String date="", date_temp="";
    char date_char = '0';
    date = inputDate;
    date_temp = date;

    String last_end="";
    char[] date_char1 = new char[8];
    if(date.length()!=8)
    {
        if(date.length()==7)
        {
            if(date.charAt(1)=='/') // 1/11/11
            {
                date_temp = date_char + date_temp.substring(0);
            }
            else // 11/1/11
            {
            last_end = date_temp.substring(3);
            date_temp = date_temp.substring(0,2) + "/0" + last_end;
            }
        }
        else // 1/1/11
        {
        //adding 0 to 1/1/11 (month >>> 01/1/11
        date_temp = date_char + date_temp.substring(0);
        //adding 0 to 01/1/11 (day >>> 01/01/11
        last_end = date_temp.substring(3);
        date_temp = date_temp.substring(0,2) + "/0" + last_end;
        }

    }

    System.out.println(date_temp);
    return date_temp;
    }
}
